/*
 * LeitorBuffer.java
 *
 * Created on 16 de Julho de 2006, 16:42
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package negocio;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 *
 * @author Gustavo F. Carvalho
 */
public class LeitorBuffer {
    
    /** Creates a new instance of LeitorBuffer */
    public LeitorBuffer() {    }
    
    public static String ler(File arquivo) {
            StringBuffer sb = new StringBuffer();
            try {
                FileReader reader = new FileReader(arquivo);
                BufferedReader bufReader = new BufferedReader(reader);
                String s;
                do {
                    s = bufReader.readLine();
                    if (s!=null) {
                            sb.append( s + "\r\n" );
                    }
                } while (s!=null);
                bufReader.close();
                reader.close();
            } catch (IOException e) {
                    e.printStackTrace();
            }
            return sb.toString();
    }
}
